﻿//-------------------------------------------------------------------------------------------------------------------------------------
// Copyright (C) 2005 greatelsoft.com All Rights Reserved
//-------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Data.Common;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Pub.Class;
using GTS.MiniBox.Entity;

namespace GTS.MiniBox.Helper {
    public partial class SMSChannelHelper {
        /// <summary>
        /// 批量删除指定短信通道
        /// </summary>
        /// <param name="cityCodeList">通道列表</param>
        /// <param name="dbkey">存在数据库连接池中的连接key，为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByChannelIDList(string channelIDList, string dbkey = "") {
            string strSql = new SQL().Delete(SMSChannelInfo._)
                .Where("1=1").Where(new Where()
                    .And(ChannelRule._ChannelID, "(" + channelIDList + ")", Operator.In)
                ).ToString();
            int value = dbkey.IsNullEmpty() ? Data.ExecSql(strSql) : Data.Pool(dbkey).ExecSql(strSql);
            if (value != 1) return false;
            return true;
        }
    }
}

